home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SuperHack
/
SuperHack CD.bin
/
SCRIPTZ
/
BACON.ZIP
/
bacon.tcl
< prev
next >
Wrap
Text File
|
1997-02-09
|
58KB
|
1,944 lines
#READ THE README.TXT FILE!
set bacon-dir "/home/flizzo/egg/scripts/"
set ctcp-finger "no no no, none of that kinky stuff here"
set ctcp-version "BitchX-69p1 by panasync : Keep it to yourself!"
set ctcp-cdcclist "Sorry, no packs offered."
#_this is used for (public)version, change only if you got a mod'd egg
#_thats been renamed, such as stealth or bongdrop
set eggname "Eggdrop"
#_one of these lines will be used with (public)away if you dont give an
#_away message along with it
proc random_away {} {
#** You can add your own away messages below **#
set aways {
"gotta go to the bathroom"
"brb"
"need some food"
}
return [lindex $aways [rand [llength $aways]]]
}
#_these are used for (public)ping when you dont specify a nick to ping
#_this will show one of these lines in the channel
proc random_ping {} {
#** You can add your own ping messages below **#
set replies {
"ping pong the witch is dead..."
"(((*((*(*PONG*)*))*)))"
"w00p w00p, you have pinged... therefore i have ponged"
"Dooooo000000000OOOOOOOO000000oooooNG!, oops i mean pong"
"pong or booooooooooooiiiiiinnnnnnnggggg!"
"why for art thou ping0ring me"
"to pong, or not to pong, that is the question"
"bLooooooOAAAAAAAAAAaaaaawwwwwwWWWWWWWWWWWWW!"
}
return [lindex $replies [rand [llength $replies]]]
}
#
#-----By editing anything below this line is violating the US law. You can
#-----face up to 5 years in prison and/or a $10,000 fine. Also if you edit
#-----anything and the script doesn't work right, ITS YOUR FAULT!
#------------------------------- -flizzo
append toolkit_loaded ""
if {$toolkit_loaded != 1} {
putlog "Toolkit.tcl must be loaded"
putlog " before you attempt to"
putlog " load Bacon.TCL"
return 0
}
set tver_ [string range [info tclversion] 0 2];set tver ""
append tver [string range $tver_ 0 0] [string range $tver_ 2 2]
if {$tver < "75"} {
putlog "INFO! TCL7.5 or above is NOT"
putlog "present! If you get any TCL"
putlog "errors, don't come to me for"
putlog "help. -flizzo"
}
set B ".!Bacon!."
#\002-Bold \037-Underline \026-Reverse
append banned-words "" ; # dont change this
append lapnum "" ; # dont change this
##########################################################################
source ${bacon-dir}bacon.cfg
global cmd-char
#fix
proc fix {x} {global cmd-char
return ${cmd-char}$x
}
#isnull
proc isnull {a} {
if {$a == "" || $a == "{}" || $a == "-help"} {return 1}
return 0
}
#b
proc b {x} {return "\002$x\002"}
#isbot
proc isbot {x} {global botnick
if {[tolower $x] == [lcase $botnick]} {return 1}
return 0
}
#ischan
proc ischan {c} {
foreach x [channels] {if {[tolower $c] == [tolower $x]} {return 1}}
return 0
}
#nops
proc nops {c} {set y ""
foreach x [chanlist $c] {
if {![isop $x $c]} {append y " $x"}
};return $y
}
proc chops {c} {set y ""
foreach x [chanlist $c] {
if {[isop $x $c]} {append y " $x"}
};return $y
}
proc isnop {n c} {if {[isop $n $c] || [isvoice $n $c]} {return 0};return 1}
proc tz {} {return [exec date +%Z]}
proc len {x} {return [string length $x]}
#index
proc index {sub string} {
set l [expr [len $sub] - 1]; set n 0
while {$n < [len $string]} {
set ss [string range $string $n [expr $l + $n]]
if {$ss == $sub} {return $n}
set n [expr $n + 1]
}
return 0
}
#
proc mid {string first last} {return [string range $string $first $last]}
proc right {string num} {return [mid $string [expr $num + 1] end]}
proc left {string num} {return [mid $string 0 [expr $num - 1]]}
proc before {sub string} {return [left $string [index $sub $string]]}
proc after {sub string} {return [right $string [index $sub $string]]}
#isodd
proc isodd {x} {
set num [expr $x * .5]
if {[isin ".5" $num]} {
return 1
} else {return 0}
}
#isin
proc isin {sub string} {
set sub [lcase $sub]
set string [lcase $string]
return [string match *${sub}* $string]
}
#mytime
proc mytime {} {
return [clock format [unixtime] -format {%A, %B %d, %Y %l:%M %p %Z}]
}
#
proc len {x} {return [string length $x]}
proc tolower {x} {return [string tolower $x]}
proc lcase {x} {return [string tolower $x]}
proc toupper {x} {return [string toupper $x]}
proc ucase {x} {return [string toupper $x]}
proc notice {n m} {putserv "notice $n :$m"}
proc act {n m} {msg $n "\001ACTION $m\001"}
proc mact {m} {foreach x [channels] {act $x $m}}
proc msg {n m} {puthelp "privmsg $n :$m"}
proc ctcp {n m} {puthelp "privmsg $n :\001${m}\001"}
proc ctcpreply {n m} {putserv "notice $n :\001${m}\001"}
proc mmsg {m} {foreach x [channels] {msg $x $m}}
proc chat {n} {global telnet;msg $n "\001DCC CHAT chat [myip] $telnet\001"}
proc join {c} {putserv "join $c"}
proc part {c} {putserv "part $c"}
proc kick {n c r} {putserv "kick $c $n :$r"}
proc topic {c t} {putserv "TOPIC $c :$t"}
proc op {c n} {putserv "MODE $c +oooo $n"}
#talks
proc talka {x} {
set x [talkc $x]
set total [len $x];set cur 0;set text ""
while {$cur < $total} {
set letter [mid $x $cur $cur]
switch [rand 3] {
0 {set text $text\002$letter\002}
1 {set text $text\26$letter\26}
default {set text $text$letter}
}
incr cur 1
}
return $text
}
proc talkl {x} {
set total [len $x];set cur 0;set text ""
set norm " abcdefghijklmnopqrstuvwxyz"
set leet " 4b(d3fgh1jk|mn0pqr5+uvwxyz"
while {$cur < $total} {
set letter [mid $x $cur $cur]
set where [index $letter $norm]
set letter2 [mid $leet $where $where]
if {$letter2 == " "} {set letter2 $letter}
set text $text$letter2
incr cur 1
}
return $text
}
proc talkc {x} {
set total [len $x];set cur 0;set text ""
while {$cur < $total} {
set letter [mid $x $cur $cur]
if {[isodd $cur]} {set letter [lcase $letter]} else {
set letter [ucase $letter]}
set text $text$letter
incr cur 1
}
return $text
}
proc talkb {string} {
set count 0;set length [string length $string];set bw2 ""
while {$count < $length} {
set where [expr [expr $length - $count] - 1]
set bw1 [string range $string $where $where]
append bw2 $bw1
incr count 1
}
return $bw2
}
#motd
proc bacon_motd {} {
global B
putlog "Heres the egg... but theres something missing!"
putlog "... its the $B !!!!!!!!!!!! TCL loaded... ::flizzo::"
}
newflag v
newflag i
newflag g
set ptime 0;append bacon-tcl-loaded 1
#uptime
if {${bacon-tcl-loaded} > 1} {
set bacon-tcl-loaded 1} else {
set load-up-time [unixtime]
set bacon-tcl-loaded 1
}
bacon_motd
#
proc bacon_setup_dcc {i a} {
global chan-modes chan-fun bot-chans bot-users chan-master cmd-char kick-msg
set b [lrange $a 1 end];set a [lindex $a 0]
switch [lcase $a] {
1 {
#Public Chan Modes - chan-modes - binds_chan_modes
if {${chan-modes} || ${chan-modes} == "on"} {
set chan-modes 0
binds_chan_modes 0
} else {
set chan-modes 1
binds_chan_modes 1
}
}
2 {
#Bot Channels - bot-chans - binds_channels
if {${bot-chans} || ${bot-chans} == "on"} {
set bot-chans 0
binds_channels 0
} else {
set bot-chans 1
binds_channels 1
}
}
3 {
#Bot Users - bot-users - binds_users
if {${bot-users} || ${bot-users} == "on"} {
set bot-users 0
binds_users 0
} else {
set bot-users 1
binds_users 1
}
}
4 {
#Fun Stuff - chan-fun - binds_fun
if {${chan-fun} || ${chan-fun} == "on"} {
set chan-fun 0
binds_fun 0
} else {
set chan-fun 1
binds_fun 1
}
}
5 {
#Public Masters - chan-master - binds_master
if {${chan-master} || ${chan-master} == "on"} {
set chan-master 0
binds_master 0
} else {
set chan-master 1
binds_master 1
}
}
6 {
#Command Character - cmd-char - chng_char
if {[isnull $b]} {
putdcc $i "Usage: $a \[character\]"
return 0
}
chng_char $b
}
7 {
#Kick Message - kick-msg
if {[isnull $b]} {
putdcc $i "Usage: $a \[kick message\]"
return 0
}
set kick_msg $b
}
exit {return 1}
quit {return 1}
.exit {return 1}
.quit {return 1}
default {putdcc $i "Not an option";return 0}
}
bacon_save
show_setup_stuff $i
return 0
}
proc show_setup_stuff {i} {
global chan-modes chan-fun bot-chans bot-users chan-master cmd-char kick-msg
putdcc $i "Select what you want to toggle (`exit` when done)"
putdcc $i "------------------------------"
putdcc $i "\[#\] description : current status"
putdcc $i "\[1\] Public Chan Modes : ${chan-modes} -op-deop-ban-unban-..."
putdcc $i "\[2\] Public Bot Chans : ${bot-chans} -addchan-delchan-..."
putdcc $i "\[3\] Public Bot Users : ${bot-users} -adduser-deluser-..."
putdcc $i "\[4\] Public Fun Stuff : ${chan-fun} -topic-say-whois-..."
putdcc $i "\[5\] Public Masters : ${chan-master} -save-jump-servers..."
putdcc $i "\[6\] Command Character : ${cmd-char}"
putdcc $i "\[7\] Default Kick Msg : ${kick-msg}"
putdcc $i ""
}
proc chng_char {x} {
global chan-modes chan-fun bot-chans bot-users chan-master cmd-char kick-msg
set bchar ${cmd-char}
if {${chan-modes} == "on" || ${chan-modes} == "1"} {
binds_chan_modes "off"
set cmd-char $x
binds_chan_modes "on"
}
set cmd-char $bchar
if {${chan-fun} == "on" || ${chan-fun} == "1"} {
binds_fun "off"
set cmd-char $x
binds_fun "on"
}
set cmd-char $bchar
if {${bot-chans} == "on" || ${bot-chans} == "1"} {
binds_channels "off"
set cmd-char $x
binds_channels "on"
}
set cmd-char $bchar
if {${bot-users} == "on" || ${bot-users} == "1"} {
binds_users "off"
set cmd-char $x
binds_users "on"
}
set cmd-char $bchar
if {${chan-master} == "on" || ${chan-master} == "1"} {
binds_master "off"
set cmd-char $x
binds_master "on"
}
set cmd-char $bchar
binds_always "off"
set cmd-char $x
binds_always "on"
bacon_save
return 1
}
proc bacon_save {} {global bacon-dir banned-words antipings show-url
global chan-modes chan-fun bot-chans bot-users chan-master cmd-char kick-msg
set save_file [open ${bacon-dir}bacon.cfg w+]
puts $save_file "
#global chan-modes chan-fun bot-chans bot-users chan-master cmd-char kick-msg
#op deop kick ban ; proc = binds_chan_modes
set chan-modes \"${chan-modes}\"
#ping time whois seen ; proc = binds_fun
set chan-fun \"${chan-fun}\"
#addchan delchan ; proc = binds_channels
set bot-chans \"${bot-chans}\"
#adduser deluser chattr ; proc = binds_users
set bot-users \"${bot-users}\"
#jump rehash save ; proc = binds_master
set chan-master \"${chan-master}\"
#default kick message
set kick-msg \"${kick-msg}\"
#command character
set cmd-char \"${cmd-char}\"
#show url on join
set show-url \"${show-url}\""
foreach x [tolower [channels]] {
puts $save_file "channel add $x \{[lrange [channel info $x] 4 end]\}"
}
puts $save_file "set banned-words \"${banned-words}\""
puts $save_file "set antipings \"${antipings}\""
close $save_file
}
proc dcc_char {h i a} {global cmd-char
if {$a == "" || $a == "{}"} {
putdcc $i "Command Character: ${cmd-char}"
return 0
}
if {$a == "-help"} {dcchelp $i "char";return 0}
chng_char [lindex $a 0]
}
proc pub_sets {n u h c a} {
if {![validuser $h]} {return 0}
global chan-modes chan-fun bot-chans bot-users chan-master cmd-char kick-msg
set binds_on ""
if {${chan-modes}} {append binds_on "Chan-Modes "}
if {${chan-fun}} {append binds_on "Chan-Fun "}
if {${bot-chans}} {append binds_on "Bot-Chans "}
if {${bot-users}} {append binds_on "Bot-Users "}
if {${chan-master}} {append binds_on "Chan-Master"}
set bindson ""
foreach x $binds_on {
append bindson " | $x"
}
set binds_on [right $bindson 2]
msg $c "(\002\037Sets\002\037(ON($binds_on)"
return 1
}
proc pub_char {n u h c a} {
if {![validuser $h]} {return 0}
global botnick cmd-char
if {$a == "" || $a == "{}" } {msg $c "(Character(${cmd-char})"
return 0
}
if {$a == "-help"} {pubhelp $c "char";return 0}
if {![matchattr $h m]} {return 0}
if {[lindex $a 1] == "" || [lindex $a 1] == "{}"} {
chng_char [lindex $a 0]
msg $c "(Character(${cmd-char})"
return 1
}
if {[lindex $a 1] == $botnick} {
chng_char [lindex $a 0];msg $c "(Character(${cmd-char})"
return 1
}
return 0
}
# *!* Binds *!* #
#bot-communication binds
bind bot - opreq bot_opreq
#wordkick bind
bind pubm - * word_kick
#quit msg binds
bind sign o * qmsg_sign
bind splt o * qmsg_splt
#auto modes
bind join - * show_url
bind join i * auto_op
bind join v * auto_v
#-
#protection flags
bind mode - "* -o *" auto_reop
bind kick - * no_kick_mn
#-
#flud bindings
bind flud - * flud_prot
#-
#ctcp binds
bind ctcp - * ctcp_reply
bind ctcr - "ping*" showpingreply
#-
#msg binds
bind msg o unban msg_unban
bind msg o unbanme msg_unban
bind msg - whoami msg_whoami
bind msg o channels msg_channels
bind msg o version msg_version
bind msg o chat msg_chat
# -msg
# - dcc binds
bind rcvd - * dcc_done
bind chon - * info_ondcc
bind pub - char pub_char
bind dcc - seen dcc_seen
bind dcc - phelp dcc_phelp
bind dcc o massnote dcc_massnote
bind dcc o ctcp dcc_ctcp
bind dcc o .match dcc_.match
bind dcc o .whois dcc_.whois
bind dcc m body proc_body
bind dcc m char dcc_char
bind dcc m setup bacon_setup_dcc_start
bind dcc m timers dcc_timers
bind dcc m utimers dcc_utimers
bind dcc m killtimer dcc_killtimer
bind dcc m killutimer dcc_killutimer
bind dcc m massop dcc_massop
bind dcc m massdeop dcc_massdeop
bind dcc m schat dcc_schat
bind dcc m addchan dcc_addchan
bind dcc m chanadd dcc_addchan
bind dcc m join dcc_addchan
bind dcc m delchan dcc_delchan
bind dcc m chandel dcc_delchan
bind dcc m part dcc_delchan
bind dcc m chanset dcc_chanset
bind dcc m setchan dcc_chanset
bind dcc m chaninfo dcc_chaninfo
bind dcc m cycle dcc_cycle
bind dcc m addop dcc_addop
bind dcc m ping dcc_ping
bind dcc m addword dcc_addword
bind dcc m delword dcc_delword
bind dcc m words dcc_words
#-
proc binds_always {st} {
if {[lcase $st] == "on" || $st == "1"} {set status "bind"}
if {[lcase $st] == "off" || $st == "0"} {set status "unbind"}
$status pub - [fix sets] pub_sets
}
proc binds_chan_modes {st} {
if {[lcase $st] == "on" || $st == "1"} {set status "bind"}
if {[lcase $st] == "off" || $st == "0"} {set status "unbind"}
$status pub o [fix op] pub_op
$status pub o [fix up] pub_op
$status pub o [fix down] pub_deop
$status pub o [fix deop] pub_deop
$status pub o [fix voice] pub_voice
$status pub o [fix +v] pub_voice
$status pub o [fix unvoice] pub_unvoice
$status pub o [fix -v] pub_unvoice
$status pub o [fix kick] pub_kick
$status pub o [fix k] pub_kick
$status pub o [fix ban] pub_ba
$status pub o [fix +ban] pub_ban
$status pub o [fix addban] pub_ban
$status pub o [fix pban] pub_pban
$status pub o [fix pb] pub_pban
$status pub o [fix +pban] pub_pban
$status pub o [fix unban] pub_unban
$status pub o [fix uban] pub_unban
$status pub o [fix ub] pub_unban
$status pub o [fix rban] pub_unban
$status pub o [fix -ban] pub_unban
$status pub o [fix cmode] pub_cmode
$status pub o [fix bans] pub_bans
$status pub o [fix unkey] pub_unkey
$status pub m [fix massop] pub_massop
$status pub m [fix massdeop] pub_massdeop
$status pub m [fix idlekick] pub_idlekick
}
proc binds_users {st} {
if {$st == "on" || $st == "1"} {set status "bind"}
if {$st == "off" || $st == "0"} {set status "unbind"}
$status pub m [fix adduser] pub_auser
$status pub m [fix auser] pub_auser
$status pub m [fix duser] pub_duser
$status pub m [fix deluser] pub_duser
$status pub m [fix chattr] pub_chattr
$status pub m [fix addbot] pub_addbot
$status pub m [fix delbot] pub_delbot
$status pub m [fix addhost] pub_addhost
$status pub m [fix delhost] pub_delhost
}
proc binds_channels {st} {
if {[lcase $st] == "on" || $st == "1"} {set status "bind"}
if {[lcase $st] == "off" || $st == "0"} {set status "unbind"}
$status pub m [fix addchan] pub_addchan
$status pub m [fix chanadd] pub_addchan
$status pub m [fix join] pub_addchan
$status pub m [fix delchan] pub_delchan
$status pub m [fix chandel] pub_delchan
$status pub m [fix part] pub_part
$status pub m [fix chanset] pub_chanset
$status pub m [fix setchan] pub_chanset
$status pub m [fix chaninfo] pub_chaninfo
}
proc binds_master {st} {
if {[lcase $st] == "on" || $st == "1"} {set status "bind"}
if {[lcase $st] == "off" || $st == "0"} {set status "unbind"}
$status pub m [fix jump] pub_jump
$status pub m [fix servers] pub_servers
$status pub m [fix save] pub_save
}
proc binds_fun {st} {
if {$st == "on" || $st == "1"} {set status "bind"}
if {$st == "off" || $st == "0"} {set status "unbind"}
$status pub o [fix topic] pub_topic
$status pub o [fix t] pub_topic
$status pub o [fix ping] pub_ping
$status pub o [fix time] pub_time
$status pub o [fix date] pub_time
$status pub o [fix whois] pub_whois
$status pub o [fix whoami] pub_whois
$status pub o [fix myflags] pub_myflags
$status pub o [fix flags] pub_myflags
$status pub o [fix chan] pub_chan
$status pub o [fix idle] pub_idle
$status pub o [fix sv] pub_sv
$status pub o [fix ver] pub_sv
$status pub o [fix version] pub_sv
$status pub o [fix binfo] pub_binfo
$status pub o [fix botinfo] pub_binfo
$status pub o [fix match] pub_match
$status pub o [fix bots] pub_bots
$status pub o [fix isbot] pub_isbot
$status pub o [fix say] pub_say
$status pub o [fix msg] pub_msg
$status pub o [fix act] pub_act
$status pub o [fix me] pub_act
$status pub o [fix action] pub_act
$status pub o [fix act2] pub_act2
$status pub o [fix notice] pub_not
$status pub o [fix notice2] pub_not2
$status pub o [fix wall] pub_wall
$status pub o [fix onotice] pub_wall
$status pub o [fix chat] pub_chat
$status pub o [fix find] pub_finduser
$status pub o [fix email] pub_email
$status pub o [fix info] pub_info
$status pub - [fix seen] pub_seen
$status pub - seen pub_seen
$status pub o [fix atalk] pub_talka
$status pub o [fix btalk] pub_talkb
$status pub o [fix ctalk] pub_talkc
$status pub o [fix ltalk] pub_talkl
$status pub o [fix len] pub_len
$status pub o [fix users] pub_users
$status pub o [fix nusers] pub_nusers
$status pub o [fix quitmsg] pub_quitmsg
$status pub o [fix myquit] pub_quitmsg
$status pub o [fix url] pub_url
#+m
$status pub m [fix addword] pub_addword
$status pub m [fix away] pub_away
$status pub m [fix back] pub_back
$status pub m [fix antiping] pub_antiping
$status pub o [fix words] pub_words
$status pub m [fix delword] pub_delword
}
# *!* Binds END *!* #
# _-^-_-------!STOP!-------_-^-_ #
proc bot_opreq {b cmd a} {global botnick
set chan [lindex $a 1]
set nick [lindex $a 0]
if {![botisop $chan] || [isop $nick $chan] || ![onchan $nick $chan]} {return 0}
putserv "MODE $chan +o $nick"
return 0
}
proc fixgainops {} {
foreach channel [channels] {
channel set $channel need-op "gain-ops $channel"
}
}
proc gain-ops {chan} {
global botnick
set chops [chops $chan]
if {[isnull $chops]} {
notice $chan "Hey guys! Wake up!! Leave the chan so we can get ops!!!"
return 0
}
foreach x $chops {
putallbots "opreq $botnick $chan"
notice $x "Hey! you there? op me f00l!"
}
}
proc dcc_.whois {h i a} {
set who [lindex $a 0]
if {[isnull $a]} {set who $h}
if {![validuser $who]} {
putdcc $i "(Error($who is not a user)"
return 0
}
set idle ""
if {[lcase $h] == "*ban"} {
putdcc $i "(Whois(*ban) (who cares about those lamuhs)"
return 0
}
if {[isnull [getemail $h]]} {
set email "not!set@yet"
} else {
set email [getemail $h]
}
set info ""
set seen [lastseenhand "1" $h]
if {![isnull [getinfo $h]]} {set info [getinfo $h]}
if {[left $info 1] == "@"} {set info [after "@" $info]}
if {[lcase $who] == [lcase $h]} {
set seen ""
}
set url [geturl $h]
putdcc $i "(Whois($h) (Flags([chattr $h])"
putdcc $i "(Email($email) $seen"
if {![isnull $info]} { putdcc $i "(Info($info)"}
if {![isnull $url]} { putdcc $i "(URL($url)"}
return 1
}
proc dcc_.match {h i a} {
set flag [lindex $a 0]
set users [userlist $flag]
set tot [llength $users]
putdcc $i "(Users(${flag}/${tot}($users)"
return 1
}
proc dcc_ctcp {h i a} {
if {[isnull [lindex $a 1]]} {dcchelp $i ctcp;return 0}
ctcp [lindex $a 0] [lrange $a 1 end]
return 1
}
proc dcc_words {h i a} {global banned-words
putdcc $i "(Words(${banned-words})"
return 0
}
proc dcc_addword {h i a} {
foreach nw $a {
if {![addword $a]} {putdcc $i "(Error(AddWord(adding sw)"}
}
return 1
}
proc dcc_delword {h i a} {global banned-words
if {[isnull $a]} {dcchelp $i delword;return 0}
set dw [lcase [lindex $a 0]]
set newwords ""
if {![isin $dw ${banned-words}]} {
putdcc $i "(Error($dw is not a banned work)"
return 0
}
foreach w ${banned-words} {
if {$dw != $w} {append newwords " $w"}
}
set banned-words $newwords
bacon_save
return 1
}
proc msg_chat {n u h a} {
chat $n
notice $n "DCC Chat request sent to you, '/dcc chat ${botnick}'"
return 1
}
proc auto_reop {n u h c m} {
if {[matchattr $h n]} {return 0}
if {[lindex $m 0] == "-o" && [matchattr [nick2hand [lindex $m 1] $c] g]} {
putserv "MODE $c +o [lindex $m 1]"
}
return 0
}
proc dcc_addop {h i a} {global botnick textdir
if {[isnull $a]} {dcchelp $i addop;return 0}
set hand [lindex $a 0]
foreach c [channels] {
if {[onchan $hand $c]} {
adduser $hand [maskhost [getchanhost $hand $c]]
chattr $hand +of
dumpfile $hand ${textdir}/addop
return 1
}
}
putdcc $i "$hand is not on any channels i am on"
return 0
}
proc pub_url {n u h c a} {
if {[isnull $a]} {
if {[isnull [geturl $h]]} {seturl $h "http://www.fishnet.net/~vince"}
msg $c "(\002\037URL\002\037(${h}([geturl $h])"
return 1
}
set a0 [lindex $a 0]
if {[validuser $a0]} {
if {[isnull [geturl $a0]]} {seturl $a0 "http://www.fishnet.net/~vince"}
msg $c "(\002\037URL\002\037(${a0}([geturl $a0])"
return 1
}
if {![isin "." $a]} {
msg $c "wtf a url without a '.' in it?"
return 0
}
seturl $h [lindex $a 0]
msg $c "(\002\037URL\002\037(${h}([geturl $h])"
return 1
}
proc seturl {h u} {
if {$u == "none"} {set u ""}
user-set $h url $u
}
proc geturl {h} {return [user-get $h url]}
proc show_url {n u h c} {global show-url
if {${show-url} != 1} {return 0}
if {![validuser $h]} {return 0}
set url [geturl $h]
if {[isnull $url]} {return 0}
msg $c "(${url})"
return 0
}
proc dcc_cycle {h i a} {
if {[isnull $a]} {return 0}
set chan [lindex $a 0]
if {![ischan $chan]} {return 0}
putserv "PART $chan"
putserv "JOIN $chan"
return 1
}
proc dcc_done {h n p} {
set path $p
while {[isin "/" $path]} {
set path [after "/" $path]
}
set file $path
notice $n "woohoo, thanx to you I know have '${file}'"
return 0
}
proc pub_delword {n u h c a} {global banned-words
set dw [lcase [lindex $a 0]]
set newwords ""
if {![isin $dw ${banned-words}]} {
msg $c "(\002\037Error\002\037($dw is not a banned work)"
return 0
}
foreach w ${banned-words} {
if {$dw != $w} {append newwords " $w"}
}
msg $c "(\002\037DelWord\002\037($dw)"
set banned-words $newwords
bacon_save
return 1
}
proc pub_words {n u h c a} {global banned-words
msg $c "(\002\037Words\002\037(${banned-words})"
return 1
}
proc addword {w} {global banned-words
set nw [lcase $w]
if {[isin $nw ${banned-words}]} {return 0}
append banned-words " $nw"
bacon_save
return 1
}
proc pub_addword {n u h c a} {
foreach nw $a {
if {[addword $a]} {msg $c "(\002\037WordKick\002\037(Added(${nw})"}
}
return 1
}
proc word_kick {n u h c a} {global banned-words
if {[matchattr $h m]} {return 0}
foreach w ${banned-words} {
if {[isin $w $a]} {putserv "kick $c $n :(WordKick($w)";return 0}
}
return 0
}
proc qmsg_splt {n u h c} {
user-set $h quitmsg "Server Split"
return 0
}
proc qmsg_sign {n u h c a} {
user-set $h quitmsg $a
return 0
}
proc pub_quitmsg {n u h c a} {
set who $h
if {![isnull $a]} {set who [lindex $a 0]}
if {![validuser $who]} {
msg $c "(\002\037Error\002\037($who is not a known user)"
return 0
}
set quit [user-get $who quitmsg]
if {[isnull $quit]} {set quit "no record of quit msg recorded"}
msg $c "(\002\037LastQuitMsg\002\037(${who}(${quit})"
return 1
}
proc auto_v {n u h c} {
if {![botisop $c]} {return 0}
utimer [expr [rand 5] + 2] "doautov $c $n"
return 0
}
proc auto_op {n u h c} {
if {![botisop $c]} {return 0}
utimer [expr [rand 5] + 2] "doautoop $c $n"
return 0
}
proc doautov {c n} {
if {![isop $n $c]} {putserv "MODE $c +v $n"}
return 0
}
proc doautoop {c n} {
if {![isop $n $c]} {putserv "MODE $c +o $n"}
return 0
}
proc info_ondcc {hand idx} {
set info [getinfo $hand]
if {[isnull $info]} {return 0}
if {[left $info 1] == "@"} {set info [after "@" $info]}
set infoline "($hand) $info"
dccbroadcast $infoline
return 0
}
proc no_kick_mn {nick uhost hand chan knick reas} {global botnick
if {[matchattr $hand n]==1 || $nick == $botnick} {return 0}
set khand [nick2hand $knick $chan]
if {[matchattr $khand n]} {
putserv "INVITE $knick $chan"
putserv "KICK $chan $nick :$knick is too leet to be kicked by you"
return 0
}
if {[matchattr $khand m] && ![matchattr $hand m]} {
putserv "INVITE $knick $chan"
putserv "KICK $chan $nick :$knick is too leet to be kicked by you"
return 0
}
return 0
}
proc dcc_chaninfo {h i a} {
set r 0
if {[isnull $a]} {dcchelp $i "chaninfo";return 0}
set a [tolower [lindex $a 0]]
if {[left $a 1] != "#"} {set a "#$a"}
foreach x [tolower [channels]] {if {$x == $a} {set r 1}}
if {$r == 0} {putdcc $i "(Error(i am not on $a)";return 0}
set sets [lrange [channel info $a] 4 end]
putdcc $i "(\002\037Chan\002\037(Sets(${a}($sets)"
return 1
}
proc dcc_chanset {h i a} {
set r 0
if {[isnull $a] || [isnull [lindex $a 1]]} {dcchelp $i "chanset";return 0}
set s [lrange $a 1 end];set a [tolower [lindex $a 0]]
if {[left $a 1] != "#"} {set a "#$a"}
foreach x [tolower [channels]] {if {$x == $a} {set r 1}}
if {$r == 0} {
putdcc $i "(\002\037Error\002\037(i am not on $a)"
return 0
}
channel set $a $s
putdcc $i "(\002\037Chan\002\037(Sets(${a}([lrange [channel info $a] 4 end])"
bacon_save
return 1
}
proc dcc_delchan {h i a} {
set a [tolower $a]
if {[isnull $a]} {dcchelp $i "delchan";return 0}
if {[left $a 1] != "#"} {set a "#$a"}
if {![ischan $a]} {
putdcc $i "(\002\037Error\002\037(i am not on $a)"
return 0
}
putdcc $i "(\002\037Chan\002\037(Removed($a)"
channel remove $a
bacon_save
return 1
}
proc dcc_addchan {h i a} {
if {[isnull $a]} {dcchelp $i addchan;return 0}
set b [lrange $a 1 end]
set a [lindex $a 0]
if {[left $a 1] != "#"} {set a "#$a"}
channel add $a $b
set sets [lrange [channel info $a] 4 end]
putdcc $i "(\002\037Chan\002\037(Added($a)"
bacon_save
return 1
}
proc ctcp_reply {n u h d k a} {
global ctcp-finger ctcp-version ctcp-cdcclist ctcp-userinfo
set k [lcase $k];set reply ""
if {$k == "finger"} {set reply ${ctcp-finger}}
if {$k == "version"} {set reply ${ctcp-version}}
if {$k == "cdcclist"} {set reply ${ctcp-cdcclist}}
#[lash TIME reply]: Sat Feb 08 00:09:58 1997
if {$k == "time"} {set reply "Time: [mytime]"}
if {$k == "ping"} {return 0}
if {$k == ""} {return 1}
if {$reply == ""} {return 1}
ctcpreply $n $reply
return 1
}
proc pub_nusers {n u h c a} {
set num 0
set nusers ""
foreach x [chanlist $c] {
if {![validuser [nick2hand $x $c]]} {
incr num 1
append nusers " $x"
}
}
msg $c "(\002\037Nusers\002\037($c/${num}($nusers)"
return 1
}
proc pub_users {n u h c a} {
set num 0
set users ""
foreach x [chanlist $c] {
if {[validuser [nick2hand $x $c]]} {
incr num 1
append users " $x"
}
}
msg $c "(\002\037Users\002\037($c/${num}($users)"
return 1
}
proc pub_save {n u h c a} {
save
msg $c "(\002\037Saving...\002\037(done)"
return 1
}
proc bacon_setup_dcc_start {h i a} {control $i bacon_setup_dcc
putdcc $i "Wecome to the setup script for Bacon!"
putdcc $i ""
show_setup_stuff $i
}
proc pub_talka {n u h c a} {msg $c [talka $a]}
proc pub_talkb {n u h c a} {msg $c [talkb $a]}
proc pub_talkc {n u h c a} {msg $c [talkc $a]}
proc pub_talkl {n u h c a} {msg $c [talkl $a]}
proc proc_body {i h a} {putdcc $h [info body $a]}
proc msg_whoami {n u h a} {
if {![validuser $h]} {return 0}
msg $n "(You(${h}(Flags([chattr $h])"
return 1
}
proc msg_channels {n u h a} {
msg $n "(Channels([channels])"
return 1
}
proc msg_version {n u h a} {global sv;msg $n $sv}
proc msg_unban {n u h a} {
set anychans 0
if {$a == "-help"} {msghelp $n unban;return 1}
foreach c [channels] {
foreach x [chanbans $c] {
if {[string match $x ${n}!$u] == 1} {
putserv "MODE $c -b $x"
msg $n "found $x on ${c}, unbanning..."
putserv "INVITE $n $c"
set anychans 1
}
}
}
if {$anychans != "1"} {
msg $n "(Error(no ban matching $u in any channels)"
return 0
}
return 1
}
proc dcc_schat {h i a} {set a [lindex $a 0];global botnick
if {[isnull $a]} {dcchelp $i "schat";return 0}
chat $a
notice $a "DCC Chat request sent to you, '/dcc chat ${botnick}'"
return 1
}
proc pub_idlekick {n u h c a} {
global kick-msg
set klist ""
set time_ [lindex $a 0]
set time [expr [lindex $a 0] - 1]
set reason [lrange $a 1 end]
if {[isnull $reason]} {set reason ${kick-msg}}
foreach x [nops $c] {if {[getchanidle $x $c] > $time} {append klist "$x "}}
set cur 1;set tot [llength $klist]
foreach x $klist {
putserv "kick $c $x :(IdleKick(${time_ mins}(${cur}/${tot}($reason)"
incr cur 1
}
return 1
}
proc pub_len {n u h c a} {msg $c "(\002\037Length\002\037(${a}([len $a])"}
proc pub_talka {n u h c a} {msg $c [talka $a]}
proc pub_talkb {n u h c a} {msg $c [talkb $a]}
proc pub_talkc {n u h c a} {msg $c [talkc $a]}
proc pub_talkl {n u h c a} {msg $c [talkl $a]}
proc dcc_seen {h i a} {
if {$a == "-help"} {dcchelp $i "seen";return 0}
putdcc $i [lastseenhand "$h" $a]
return 1
}
proc pub_seen {n u h c a} {
if {$a == "-help"} {pubhelp $c "seen";return 0}
msg $c [lastseenhand $n $a]
return 1
}
proc lastseenhand {n a} {
set w [lcase [lindex $a 0]]
if {[isnull $a]} {return "sorry, never seen the invisible man"}
if {[lcase $n] == [lcase $w]} {return "($w) is some blind lamuh"}
foreach c [channels] {
set nick [hand2nick $w $c]
if {[lcase $nick] == $n} {
return "($w) is some blind lamuh"
}
}
if {$a == "*ban"} {return "who cares when those lamers were here"}
if {[isbot $w]} {return "unless i am seeing things, i am right here"}
foreach x [channels] {
if {[onchansplit $w $x]} {
return "(\002\037Seen\002\037(${w}(was seen riding a split in $x)"
}
}
foreach x [channels] {
if {[onchan $w $x]} {
if {[validuser [nick2hand $w $x]]} {
return "(\002\037Seen\002\037($w is on $x)"
} else {
return "(\002\037Seen\002\037($w is on ${x}, but its a fake)"
}
}
}
foreach c [channels] {
if {[handonchan $w $c]} {
return "(\002\037Seen\002\037(${w}(is really [hand2nick $w $c])"
}
}
if {![validuser $w]} {return "(\002\037Error\002\037(i dont know who $a is)"}
return [getlastseen $w]
}
proc fixtimeago {time} {
set cur [unixtime]
set last $time
set since [expr $cur - $last]
return [fixmins2stuff $since]
}
proc fixmins2stuff {since} {
set year 0;set month 0;set week 0;set day 0;set hour 0;set min 0
set years "";set months "";set weeks "";set days "";set hours "";
set mins "";set secs ""
while {$since > 31535999} {incr year 1;incr since -31536000}
#while {$since > 2591999} {incr month 1;incr since -2592000}
while {$since > 604799} {incr week 1;incr since -604800}
while {$since > 86399} {incr day 1;incr since -86400}
while {$since > 3599} {incr hour 1;incr since -3600}
while {$since > 59} {incr min 1;incr since -60};set sec $since
if {$year > 1} {set years " $year years "}
if {$year == 1} {set years "1 year "}
#if {$month > 1} {set months "$month months "}
if {$month == 1} {set months "1 month "}
if {$week > 1} {set weeks "$week weeks "}
if {$week == 1} {set weeks "1 week "}
if {$day > 1} {set days "$day days "}
if {$day == 1} {set days "1 day "}
if {$hour > 1} {set hours "$hour hours "}
if {$hour == 1} {set hours "1 hour "}
if {$min > 1} {set mins "$min minutes "}
if {$min == 1} {set mins "1 minute "}
if {$sec > 1} {set secs "$sec seconds "}
if {$sec == 1} {set secs "1 second "}
if {$sec == 0} {set secs ""}
set when "$years$months$weeks$days$hours$mins$secs"
if {$when == ""} {return ""}
return [left $when [expr [len $when] - 1]]
}
proc getlastseen {h} {
return "(\002\037Seen\002\037(${h}([fixtimeago [getlaston $h]] ago)"
}
#seenend
proc pub_info {n u h c a} {
if {[isnull $a]} {
msg $c "(\002\037Info\002\037(${h}([getinfo $h])"
return 1
}
if {[isinfolock $h]} {
msg $c "(\002\037Error\002\037(info is locked for $h)"
return 0
}
if {$a == "none"} {
setinfo $h ""
msg $c "(\002\037Info\002\037(${h}(unset)"
return 1
}
setinfo $h $a
msg $c "(\002\037Info\002\037(${h}([getinfo $h])"
return 1
}
proc pub_email {n u h c a} {
if {[isnull $a]} {
msg $c "(\002\037Email\002\037(${h}([getemail $h])"
return 1
}
set w [lindex $a 0]
if {[validuser $w]} {
set email [getemail $w]
if {[isnull $email]} {set email "not!set@yet"}
msg $c "(\002\037Email\002\037(${w}($email)"
return 1
}
set w [nick2hand $w $c]
if {[validuser $w]} {
set email [getemail $w]
if {[isnull $email]} {set email "not!set@yet"}
msg $c "(\002\037Email\002\037(${w}($email)"
return 1
}
setemail $h $a
msg $c "(\002\037Email\002\037(${h}($a)"
return 1
}
proc flud_prot {n u h t c} {global ignore-time ban-time
if {$t == "pub"} {
kick $n $c "(Public Flood Detected(YOU[b "->"]OUT)"
}
if {$t == "msg"} {
msg $n "Message Flood detected: Auto Ignore ${ignore-time} mins"
newignore [maskhost $u] Bacon "Message Flood" ${ignore-time}
putlog "Message flood detected from ${n}, auto ignore"
}
if {$t == "join"} {
newchanban $c [maskhost $u] Bacon "Join Flood" ${ban-time}
putlog "Join Flood detected from ${n}, auto ban"
}
if {$t == "ctcp"} {
msg $n "CTCP flood detected: Auto Ignore ${ignore-time} mins"
newignore [maskhost $u] Bacon "CTCP Flood" ${ignore-time}
putlog "CTCP flood detected from ${n}, auto ignore"
}
return 1
}
proc dcc_massnote {h i a} {global botnick
if {[isnull [lindex $a 1]]} {dcchelp $i "massnote";return 0}
set flag [lindex $a 0]
if {$flag == "+b" || $flag == "b"} {
putdcc $i "(Error(why do you want to send bots a note?)"
return 0
}
set note "[b "!MassNote!: "][lrange $a 1 end]"
set who [userlist $flag]
set num 0
foreach x $who {
if {![isbot $x] && ![matchattr $x b]} {
sendnote $h $x $note
incr num 1
}
}
putdcc $i "(MassNote(Complete($num)"
return 0
}
proc dcc_massdeop {h i a} {
if {[isnull $a]} {dcchelp $i "massdeop";return 0}
set c [lindex $a 0];if {[left $c 1] != "#"} {set c "#$c"}
if {![ischan $c]} {putdcc $i "(Error(I am not on $c)";return 0}
if {![botisop $c]} {putdcc $i "(Error(i am not OPd on $c)";return 0}
foreach x [chanlist $c] {
if {![validuser [nick2hand $x $c]] && [isop $x $c] && ![isbot $x]} {
pushmode $c -o $x
}
}
flushmode $c
return 1
}
proc dcc_massop {h i a} {
if {[isnull $a]} {dcchelp $i "massop";return 0}
set c [lindex $a 0];if {[left $c 1] != "#"} {set c "#$c"}
if {![ischan $c]} {putdcc $i "(Error(I am not on $c)";return 0}
if {![botisop $c]} {putdcc $i "(Error(i am not OPd on $c)";return 0}
foreach x [chanlist $c o] {if {![isop $x $c]} {pushmode $c +o $x}}
flushmode $c
return 1
}
proc dcc_kill_utimer {h i a} {
if {[isnull $a]} {putdcc $i "Usage: killtimer <timerID>";return 0}
killutimer [lindex $a 0]
}
proc dcc_killtimer {h i a} {
if {[isnull $a]} {putdcc $i "Usage: killutimer <utimerID>";return 0}
killtimer [lindex $a 0]
}
proc dcc_utimers {h i a} {
set t [utimers];set num [llength $t];set cn 0
if {[isnull $t]} {putdcc $i "no utimers";return 0}
putdcc $i "(#) | Seconds | ID | Command"
foreach x $t {
incr cn 1
putdcc $i "($cn) | [lindex $x 0] | [lindex $x 2] | [lindex $x 1]"
}
}
proc dcc_timers {h i a} {
set t [timers];set num [llength $t];set cn 0
if {[isnull $t]} {putdcc $i "no timers";return 0}
putdcc $i "(#) | Minutes | ID | Command"
foreach x $t {
incr cn 1
putdcc $i "($cn) | [lindex $x 0] | [lindex $x 2] | [lindex $x 1]"
}
}
proc pub_finduser {n u h c a} {global B ; set a [lindex $a 0];set mn ""
foreach x [userlist] {if {[isin $a $x]} {append mn " $x"}}
msg $c "(\002\037FindUser\002\037(\*$a\*($mn)"
return 1
}
proc pub_unkey {n u h c a} {
if {![botisop $c]} {msg $c "(Error(i am not OPd on $c)";return 0}
if {[isin "k" [getchanmode $c]]} {
putserv "mode $c -k [lindex [getchanmode $c] 1]"
return 1
}
msg $c "(\002\037Error\002\037(there is not a key on $c)"
return 0
}
proc pub_massdeop {n u h c a} {
if {![botisop $c]} {
msg $c "(\002\037Error\002\037(i am not OPd on $c)"
return 0
}
foreach x [chanlist $c] {
if {![validuser [nick2hand $x $c]] && [isop $x $c]} {pushmode $c -o $x}
}
flushmode $c
return 1
}
proc pub_massop {n u h c a} {
if {![botisop $c]} {
msg $c "(Error(i am not OPd on $c)"
return 0
}
foreach x [chanlist $c o] {if {![isop $x $c]} {pushmode $c +o $x}}
flushmode $c
return 1
}
proc pub_antiping {n u h c a} {global antipings
if {[isnull $a]} {pubhelp $c "antiping"}
if {[lcase [lindex $a 0]] == "off"} {
foreach x [timers] {
if {[isin "sapmtc" [lindex $x 1]]} {
killtimer [lindex $x 2]
msg $c "(\002\037Antiping\002\037(is now off)"
return 0
}
}
}
if {[lcase [lindex $a 0]] == "on"} {
foreach x [timers] {
if {[isin "sapmtc" [lindex $x 1]]} {
msg $c "(\002\037Error\002\037(AntiPing(already turned on)"
return 0
}
}
sapmtc
return 1
}
foreach x [timers] {
if {[isin "sapmtc" [lindex $x 1]]} {
killtimer [lindex $x 2]
}
}
if {[llength $antipings] > 4} {
set antipings "[lrange $antipings 1 4] {$a}"
} else {
append antipings " {$a}"
}
bacon_save
timer 7 "sapmtc"
mmsg $a
return 1
}
proc sapmtc {} {global antipings lapnum
set num [rand [llength $antipings]]
while {$num != $lapnum} { set num [rand [llength $antipings]] }
set lapnum $num
mmsg [lindex $antipings $num]
timer 7 "sapmtc"
}
proc pub_back {n u h c a} {
putserv "AWAY"
if {[isnull $a]} {set a "bacon and eggs work for me!"}
mact "is back ([b $a])"
return 1
}
proc pub_away {n u h c a} {
if {[isnull $a]} {set a "[random_away]"}
putserv "AWAY :$a"
mact "is away: ([b $a])"
return 1
}
proc pub_chat {n u h c a} {
if {[isnull $a]} {set a $n};set a [lindex $a 0]
chat $a
}
proc pub_wall {n u h c a} {global botnick
if {![botisop $c]} {
msg $c "(\002\037Error\002\037(i am not OPd on $c)"
return 0
}
if {[isnull $a]} {set a "$n iS tOo eReEt FOr mE"}
foreach x [chanlist $c] {
if {[isop $x $c] && $botnick != $x} {notice $x "(OPs($c) $a"}
}
return 1
}
proc pub_not2 {n u h c a} {
if {[isnull [lindex $a 1]]} {notice $c "$n iS tOo eReEt FOr mE";return 0}
notice [lindex $a 0] [lrange $a 1 end]
return 1
}
proc pub_not {n u h c a} {
if {[isnull $a]} {set a "$n iS tOo eReEt FOr mE"}
notice $c $a
return 1
}
proc pub_act2 {n u h c a} {
if {[isnull [lindex $a 1]]} {act $c "iS nOt eReEt EnOUgH FOr $n";return 1}
act [lindex $a 0] [lrange $a 1 end]
return 1
}
proc pub_act {n u h c a} {
if {[isnull $a]} {set a "iS nOt eReEt EnOUgH FOr $n"}
act $c $a
return 1
}
proc pub_msg {n u h c a} {
if {[isnull $a]} {msg $c "$n iS tO eReEt FOr mE";return 0}
if {[llength $a] < 2} {set a "$c $n iS tO eReEt FOr mE"}
msg [lindex $a 0] [lrange $a 1 end]
return 1
}
proc pub_say {n u h c a} {
if {[isnull $a]} {set a "$n iS tO eReEt FOr mE"}
msg $c $a
return 1
}
proc pub_isbot {n u h c a} {global botnick
if {[isnull $a]} {pubhelp $c "isbot";return 0}
set bot [lcase [lindex $a 0]]
if {[lcase $botnick] == $bot} {
msg $c "well theres a no brainer"
return 0
}
foreach x [bots] {
if {[lcase $x] == $bot} {
msg $c "(\002\037IsBot\002\037(${bot}(YES)"
return 1
}
}
msg $c "(\002\037IsBot\002\037(${bot}(NO)"
return 1
}
proc pub_bots {n u h c a} {
set num2 [llength [bots]];set num "only myself"
if {$num2 > 0} {set num "[expr $num2 + 1] Total"}
msg $c "(\002\037Bots\002\037($num)"
return 1
}
proc pub_match {n u h c a} {
if {[isnull $a]} {pubhelp $c "match";return 0}
set a [lindex $a 0]
set list [userlist $a];set num [llength $list]
if {![isnull $list]} {msg $c "(Match(+${a}(${num}[b "/"]$list)";return 1}
msg $c "(\002\037Error\002\037(no users matching +$a)"
return 0
}
proc pub_binfo {n u h c a} {global version server load-up-time eggname
set num [llength [channels]];set users [llength [userlist]]
msg $c "(\002\037Ver\002\037($eggname[lindex $version 0]) (\002\037Chans\002\037($num) (\002\037Users\002\037($users)"
msg $c "(\002\037Uptime\002\037([fixtimeago ${load-up-time}])"
return 1
}
proc pub_sv {n u h c a} {global sv;msg $c "$sv"}
proc pub_idle {n u h c a} {global botnick;set botnick [tolower $botnick]
if {$a == "-help"} {pubhelp "idle";return 0}
if {[isnull $a]} {msg $c "whose idle?";return 0}
set n [lcase [lindex $a 0]]
if {$botnick == $n} {msg $c "i am not idle";return 0}
if {![onchan $n $c]} {
msg $c "(\002\037Error\002\037($n is not on $c)"
return 0
}
set ci [getchanidle $n $c]
set extra ""
if {$ci < 1} {
msg $c "(\002\037Idle\002\037(${n}(not even a minute)"
return 1
}
set ci [expr $ci * 60]
set ci [fixmins2stuff $ci]
msg $c "(\002\037Idle\002\037(${n}($ci) $extra"
return 1
}
proc pub_chan {n u h c a} {
if {$a == "-help"} {pubhelp "chan";return 0};set a [lindex $a 0]
if {[isnull $a]} {set chan $c} else {set chan $a}
if {![ischan $chan]} {
msg $c "(\002\037Error\002\037(i am not $chan)"
return 0
}
set mode [getchanmode $chan];set bans [llength [chanbans $chan]];set tot "0"
set chops "0";set nops "0";set voice "0";set users "0";set nusers "0"
foreach x [chanlist $chan] {incr tot 1
if {[isop $x $chan]} {incr chops 1}
if {[isnop $x $chan]} {incr nops 1}
if {[isvoice $x $chan] && ![isop $x $chan]} {incr voice 1}
if {[nick2hand $x $chan] == "" || [nick2hand $x $chan] == "*"} {
incr nusers 1
} else {
incr users 1
}
}
msg $c "(\002\037Channel\002\037($chan) (\002\037Mode\002\037($mode) (\002\037Bans\002\037($bans) (\002\037Total\002\037($tot)"
msg $c "(\002\037Chops\002\037($chops) (\002\037Nops\002\037($nops) (\002\037Voice\002\037($voice) (\002\037Users\002\037($users) (\002\037Non\002\037($nusers)"
return 1
}
proc pub_myflags {n u h c a} {
if {$a == "-help"} {pubhelp $c "myflags";return 0}
if {[isnull $a]} {
msg $c "(\002\037Flags\002\037(${h}(+[chattr $h])"
return 1
}
set a [lindex $a 0]
if {[validuser $a]} {
msg $c "(\002\037Flags\002\037(${a}(+[chattr $a])"
return 1
}
set h [nick2hand $a $c]
if {[validuser $h]} {
msg $c "(\002\037Flags\002\037(${h}(+[chattr $h])"
return 1
}
return 0
}
proc pub_whois {n u h c a} {global botnick
if {[isnull $a]} {set a $n};set a [tolower [lindex $a 0]]
if {$a == [tolower $botnick]} {msg $c "well theres a no brainer";return 0}
if {[validuser $a]} {do_whois $c $n $a;return 1}
if {[validuser [nick2hand $a $c]]} {
msg $c "$a is really [nick2hand $a $c]"
do_whois $c $n [nick2hand $a $c]
return 1
}
msg $c "($a) must be a sausage eater, cause i dont know him"
return 0
}
set eggver [lindex $version 0];set eggpatches [lrange $version 3 end]
set tclver [info tclversion]
set bv "(v2.0)"
set sv "${eggname}${eggver}+Tcl${tclver}+$B$bv ::flizzo::"
proc do_whois {c n h} {set whom "some lamuh that gives head";set idle ""
if {[lcase $h] == "*ban"} {
msg $c "(\002\037Whois\002\037(*ban(who cares about those lamuhs)"
return 0
}
if {[isnull [getemail $h]]} {
set email "not!set@yet"
} else {
set email [getemail $h]
}
set ci [getchanidle [hand2nick $h $c] $c]
set ci [expr $ci * 60]
set ci [fixmins2stuff $ci]
if {[isnull $ci]} {set ci "nope"}
set info ""
set seen [lastseenhand "1" $h]
if {[isin "is on" $seen]} {set seen ""}
if {![isnull [getinfo $h]]} {set info [getinfo $h]}
if {[left $info 1] == "@"} {set info [after "@" $info]}
set ci "(\002\037Idle\002\037($ci)"
if {[lcase $n] == [lcase [hand2nick $h $c]]} {
set seen ""
set ci ""
}
set url [geturl $h]
msg $c "(\002\037Whois\002\037($h) (\002\037Flags\002\037([chattr $h]) $ci"
msg $c "(\002\037Email\002\037($email) $seen"
if {![isnull $info]} {msg $c "(\002\037Info\002\037($info)"}
if {![isnull $url]} {msg $c "(\002\037URL\002\037($url)"}
}
proc isinfolock {h} {
set info [getinfo $h]
if {[left $info 1] == "@"} {return 1}
return 0
}
proc pub_time {n u h c a} {msg $c "[mytime]";return 1}
proc dcc_ping {h i a} {
ctcp $a "PING [unixtime]"
return 1
}
proc pub_ping {n u h c a} {global botnick
if {$a == "-help"} {pubhelp $c "ping"}
if {[isnull $a]} {
msg $c "[random_ping]";return 1}
set a [tolower [lindex $a 0]]
if {[left $a 1] == "#"} {
msg $c "ewww thats gross, the whole chan at once!"
return 0
}
ctcp $a "PING [unixtime]"
return 1
}
proc showpingreply {n u h d k a} {
set n [tolower $n]
set reptime "[expr [unixtime] - [lindex $a 0]] seconds"
mmsg "(\002\037PingReply\002\037(${n}($reptime)"
#putlog "$n $u $h $d $k $a"
return 0
}
proc pub_delhost {n u h c a} {
if {[isnull $a] || [isnull [lindex $a 1]]} {
pubhelp $c "delhost"
return 0
}
set b [lindex $a 1];set a [lindex $a 0]
if {[validuser $a]} {
delhost $a $b
msg $c "(\002\037User\002\037(DelHost(${a}($b)"
return 1
}
if {[validuser [nick2hand $a $c]]} {
delhost [nick2hand $a $c] $b
msg $c "(\002\037User\002\037(DelHost(${a}($b)"
return 1
}
msg $c "(\002\037Error\002\037($a is not a user)"
return 0
}
proc pub_addhost {n u h c a} {
global B
if {[isnull [lindex $a 1]]} {pubhelp $c "addhost";return 0}
set b [lindex $a 1];set a [lindex $a 0]
if {[validuser $a]} {
addhost $a $b
msg $c "(\002\037User\002\037(AddHost(${a}($b)"
return 1
}
if {[validuser [nick2hand $a $c]]} {
addhost [nick2hand $a $c] $b
msg $c "(\002\037User\002\037(AddHost(${a}($b)"
return 1
}
msg $c "(\002\037Error\002\037(User($a is not a user)"
return 0
}
proc pub_chaninfo {n u h c a} {
set r 0
if {$a == "-help"} {pubhelp $c "chaninfo";return 0}
if {[isnull $a]} {set a $c}
set a [tolower [lindex $a 0]]
if {[left $a 1] != "#"} {set a "#$a"}
foreach x [tolower [channels]] {if {$x == $a} {set r 1}}
if {$r == 0} {msg $c "(\002\037Error\002\037(i am not on $a)";return 0}
set sets [lrange [channel info $a] 4 end]
msg $c "(\002\037Chan\002\037(Sets(${a}($sets)"
return 1
}
proc pub_chanset {n u h c a} {
set r 0
if {[isnull $a] || [isnull [lindex $a 1]]} {pubhelp $c "chanset";return 0}
set s [lrange $a 1 end];set a [tolower [lindex $a 0]]
if {[left $a 1] != "#"} {set a "#$a"}
foreach x [tolower [channels]] {if {$x == $a} {set r 1}}
if {$r == 0} {msg $c "(\002\037Error\002\037(i am not on $a)";return 0}
channel set $a $s
msg $c "(\002\037Chan\002\037(Sets(${a}([lrange [channel info $a] 4 end])"
return 1
}
proc pub_delchan {n u h c a} {
set r 0;set a [tolower $a]
if {[isnull $a]} {pubhelp $c "delchan";return 0}
if {[left $a 1] != "#"} {set a "#$a"}
foreach x [tolower [channels]] {if {$x == $a} {set r 1}}
if {$r == 0} {msg $c "(\002\037Error\002\037(i am not on $a)";return 0}
msg $c "(\002\037Chan\002\037(Removed($a)"
channel remove $a
bacon_save
return 1
}
proc pub_addchan {n u h c a} {
if {[isnull $a]} {pubhelp $c "addchan";return 0}
set b [lrange $a 1 end]
set a [lindex $a 0]
if {[left $a 1] != "#"} {set a "#$a"}
channel add $a $b
set sets [lrange [channel info $a] 4 end]
msg $c "(\002\037Chan\002\037(Added($a)"
bacon_save
return 1
}
proc pub_servers {n u h c a} {
global servers;set num 1;msg $c "(#) Server"
foreach x $servers {msg $c "($num) $x";incr num 1}
}
proc pub_jump {n u h c a} {
global B botnick servers
if {[isnull $a]} {pubhelp $c "jump";return 0}
if {![isnull [lindex $a 1]] && [lindex $a 1] != $botnick} {return 0}
if {[string range $a 0 0] == "#"} {
set num 1
foreach x $servers {
if {[isin ":" $x]} {set y [after ":" $x];set x [before ":" $x]}
if {$num == [string range $a 1 1]} {jump $x $y;return 1}
incr num 1
}
msg $c "(\002\037Error\002\037(no server #[string range $a 1 1])"
return 0
}
if {[isin ":" $x]} {set y [after ":" $x];set x [before ":" $x]}
jump "$a"
return 1
}
proc pub_delbot {n u h c a} {
set bot [lindex $a 0]
if {[isnull $a]} {pubhelp $c "delbot";return 0}
if {![validuser $bot]} {msg $c "(\002\037Error\002\037($bot is not a user)";return 0}
if {![matchattr $bot b]} {msg $c "(\002\037Error\002\037($bot is not a bot)";return 0}
deluser $bot
msg $c "(\002\037User\002\037(Removed($bot)"
return 1
}
proc pub_addbot {n u h c a} {
if {[isnull $a] || [isnull [lindex $a 1]]} {pubhelp $c "addbot";return 0}
set bot [lindex $a 0];set add [lindex $a 1]
if {[validuser $bot]} {msg $c "(\002\037Error\002\037($bot is already a known user)";return 0}
if {![isin ":" $add]} {pubhelp $c "addbot";return 0}
addbot $bot $add
msg $c "(\002\037User\002\037(Added(${bot}($add as a bot)"
return 1
}
proc pub_chattr {n u h c a} {
if {$a == "" || $a == "{}" || $a == "-help"} {pubhelp $c "chattr";return 0}
set b [lindex $a 1]
set a [lindex $a 0]
if {[validuser $a]} {
chattr $a "+$b"
msg $c "(\002\037Chattr\002\037(${a}(+[chattr $a])"
return 1
}
if {[validuser [nick2hand $a $c]]} {
chattr [nick2hand $a $c] "+$b"
msg $c "(\002\037FYI\002\037($a is really [nick2hand $a $c])"
msg $c "(\002\037Chattr\002\037([nick2hand $a $c](+[chattr [nick2hand $a $c]])"
return 1
}
msg $c "(\002\037Error\002\037($a is not a known user)"
return 0
}
proc pub_duser {n u h c a} {
if {$a == "" || $a == "{}" || $a == "-help"} {pubhelp $c "duser";return 0}
set a [lindex $a 0]
if {[matchattr $a m] || [matchattr [nick2hand $a $c] m]} {
msg $c "(\002\037Error\002\037(cannot remove +m users from channel, use dcc chat)"
return 0
}
if {[matchattr $a n] || [matchattr [nick2hand $a $c] n]} {
msg $c "(\002\037Error\002\037(cannot remove +n users from channel, use dcc chat)"
return 0
}
if {[validuser $a]} {
deluser $a
msg $c "(\002\037User\002\037(Removed($a)"
return 1
}
if {[validuser [nick2hand $a $c]]} {
deluser [nick2hand $a $c]
msg $c "(\002\037FYI\002\037($a is really [nick2hand $a $c])"
msg $c "(\002\037User\002\037(Removed([nick2hand $a $c])"
return 1
}
msg $c "(\002\037Error\002\037($a is not a known user)"
return 0
}
proc pub_auser {n u h c a} {
global botnick
if {$a == "" || $a == "{}" || $a == "-help"} {pubhelp $c "auser";return 0}
set flags [lindex $a 1]
set a [lindex $a 0]
if {[validuser [nick2hand $a $c]]} {
msg $c "(\002\037Error\002\037($a is already known as [nick2hand $a $c])"
return 0
}
if {[validuser $a]} {
msg $c "(\002\037Error\002\037(already a user with handle $a)"
return 0
}
if {![onchan $a $c]} {msg $c "(Error($a is not on $c)";return 0}
adduser $a [maskhost [getchanhost $a $c]]
if {[len $flags] > 0} {chattr $a "+$flags"}
msg $c "(\002\037User\002\037(Added(${a}([chattr $a])"
msg $a "You have been added to my user list with flags +[chattr $a]"
msg $a "Please set a password using `/msg $botnick pass [pass]`"
return 1
}
proc pub_pban {n u h c a} {
global botnick
if {$a == "" || $a == "{}" || $a == "-help"} {pubhelp "$c" "pban";return 0}
set ban [lindex $a 0] ; set why [lrange $a 1 end]
if {$ban == "*!*@*"} {msg $c "(Error(*!*@* not allowed)";return 0}
if {![isin "!" $ban] || ![isin "@" $ban]} {
if {[onchan $ban $c]} {
set ban2 "*!*"
set mask [string trimleft [maskhost [getchanhost $ban $c]] "*!"]
set ban $ban2$mask
}}
newchanban $c $ban $h $why "0"
msg $c "(\002\037Ban\002\037(Perm($ban)"
}
proc pub_bans {n u h c a} {
set bans [chanbans $c]
if {[isnull $bans]} {msg $c "(\002\037Error\002\037(no bans on $c)";return 0}
msg $c "(#) Ban"
set num 0
foreach x $bans {
set tb [lindex $x 0]
set num [expr $num + 1]
set time [fixtime [lindex [ctime [lindex $x 2]] 3]]
if {[lindex $x 2] == "0"} {set time "(perm)"}
msg $c "($num) $tb $time"
}
}
proc fixtime {time} {
set time [lindex $time 0]
set hrs [string range $time 0 1]
if {$hrs > 12} {
set hrs [expr $hrs - 12]
return "$hrs[string range $time 2 end] PM"
}
return "[string range $time 1 end] AM"
}
proc pub_unban {n u h c a} {
if {$a == "" || $a == "{}" || $a == "-help"} {pubhelp "$c" "unban";return 0}
if {![botisop $c]} {msg $c "(Error(i am not OPd on $c)";return 0}
if {$a == "-all"} {
foreach x [chanbans $c] {killchanban $c [lindex $x 0]}
msg $c "(Ban(Removed all bans from $c)"
return 1
}
if {[string range $a 0 0] == "#"} {
set bnum [string range $a 1 1]
set bans [chanbans $c]
if {$bans == "" || $bans == "{}"} {msg $c "(\002\037Error\002\037(no bans on $c)";return 0}
set num 0
foreach x $bans {
set num [expr $num + 1]
if {$bnum == $num} {
killchanban $c [lindex $x 0]
putserv "MODE $c -b [lindex $x 0]"
return 1
}
}
msg $c "(\002\037Error\002\037(no ban #$a on $c)"
return 0
}
if {![ischanban $a $c]} {msg $c "(\002\037Error\002\037($a is not a ban on $c)";return 0}
killchanban $c $a
msg $c "(Ban(Removed $a from $c)"
putserv "MODE $c -b $a"
return 1
}
proc pub_cmode {n u h c a} {
set b [lindex $a 0]
if {$b == "" || $b == "{}" || $b == "-help"} {pubhelp "$c" "cmode";return 0}
if {![botisop $c]} {msg $c "(\002\037Error\002\037(i am not OPd on $c)";return 0}
if {[isin "o" $b]} {msg $c "(\002\037Error\002\037(not for use for OPs)";return 0}
if {[isin "v" $b]} {msg $c "(\002\037Error\002\037(not for use for voice)";return 0}
putserv "MODE $c $a"
return 1
}
proc pub_ban {n u h c a} {
global botnick
if {$a == "" || $a == "{}" || $a == "-help"} {pubhelp "$c" "ban";return 0}
set ban [lindex $a 0] ; set why [lrange $a 1 end]
if {$ban == "*!*@*"} {msg $c "(\002\037Error\002\037(*!*@* not allowed)";return 0}
if {![isin "!" $ban] || ![isin "@" $ban]} {
if {[onchan $ban $c]} {
set ban2 "*!*"
set mask [string trimleft [maskhost [getchanhost $ban $c]] "*!"]
set ban $ban2$mask
}}
newchanban $c $ban $h $why
msg $c "(\002\037Ban\002\037(Temp($ban)"
}
proc pub_topic {n u h c a} {
if {$a == "" || $a == "{}" || $a == "-help"} {pubhelp "$c" "topic";return 0}
if {![isin "t" [lindex [getchanmode $c] 0]]} {
msg $c "(\002\037Error\002\037(i am not OPd on $c) but theres no +t so...)"
topic $c $a
return 1
}
if {![botisop $c]} {msg $c "(Error(i am not OPd on $c)" ; return 0}
topic $c $a
return 1
}
proc pub_kick {n u h c a} {
set msg [lrange $a 1 end]
set n [lcase $n]
set a [lindex [tolower $a] 0]; global botnick kick-msg
if {[len $msg] < 1} {set msg ${kick-msg}}
if {$a == "-help"} {pubhelp "$c" "kick" ; return 0}
if {$a == ""} {pubhelp "$c" "kick" ; return 0}
if {$a == "{}"} {pubhelp "$c" "kick" ; return 0}
if {[isbot $a]} {set a $n}
if {[matchattr [nick2hand $a $c] m] || [matchattr [nick2hand $a $c] n]} {
msg $c "(\002\037Error\002\037($a is too leet to be kicked)"
return 0
}
if {$a == $n} {
msg $c "try /kick $c $a 1 y4m 3r33t"
return 0
}
if {![botisop $c]} {notice $c "(\002\037Error\002\037(i am not OPd on $c)" ; return 0}
if {![onchan $a $c]} {msg $c "(\002\037Error\002\037($a is not on $c)" ; return 0}
putserv "kick $c $a :$msg"
return 1
}
proc pub_unvoice {n u h c a} {
set a [lindex [tolower $a] 0]; global botnick
if {$a == "-help"} {pubhelp "$c" "unvoice" ; return 0}
if {$a == ""} {pubhelp "$c" "unvoice" ; return 0}
if {$a == "{}"} {pubhelp "$c" "unvoice" ; return 0}
if {![botisop $c]} {notice $c "(\002\037Error\002\037(i am not OPd on $c)" ; return 0}
if {![onchan $a $c]} {msg $c "(\002\037Error\002\037($a is no on $c)" ; return 0}
if {![isvoice $a $c]} {
msg $c "(\002\037Error\002\037($a doesnt have voice on $c)"
return 0
}
putserv "mode $c -v $a"
return 1
}
proc pub_voice {n u h c a} {
set a [lindex [tolower $a] 0]; global botnick
if {$a == "-help"} {pubhelp "$c" "voice" ; return 0}
if {$a == ""} {set a [tolower $n]}
if {$a == "{}"} {set a [tolower $n]}
if {![botisop $c]} {notice $c "(\002\037Error\002\037(i am not OPd on $c)" ; return 0}
if {![onchan $a $c]} {msg $c "(\002\037Error\002\037($a is not on $c)" ; return 0}
if {[isvoice $a $c]} {
msg $c "(\002\037Error\002\037($a is already voiced on $c)"
return 0
}
putserv "mode $c +v $a"
return 1
}
proc pub_deop {n u h c a} {
set a [lindex [tolower $a] 0]; global botnick
if {$a == "-help"} {pubhelp "$c" "deop" ; return 0}
if {$a == ""} {pubhelp "$c" "deop" ; return 0}
if {$a == "{}"} {pubhelp "$c" "deop" ; return 0}
if {[isbot $a]} {set a $n}
if {![botisop $c]} {notice $c "(\002\037Error\002\037(i am not OPd on $c)" ; return 0}
if {![onchan $a $c]} {msg $c "(\002\037Error\002\037($a is not on $c)" ; return 0}
if {![isop $a $c]} {msg $c "(\002\037Error\002\037($a is already deOPd on $c)" ; return 0}
putserv "mode $c -o $a"
return 1
}
proc pub_op {n u h c a} {
set a [lindex [tolower $a] 0]
if {$a == "-help"} {pubhelp "$c" "op" ; return 0}
if {$a == ""} {set a [tolower $n]}
if {$a == "{}"} {set a [tolower $n]}
if {![botisop $c]} {notice $c "(\002\037Error\002\037(i am not OPd on $c)" ; return 0}
if {![onchan $a $c]} {msg $c "(\002\037Error\002\037($a is not on $c)" ; return 0}
if {[isop $a $c]} {msg $c "(\002\037Error\002\037($a is already OPd on $c)" ; return 0}
putserv "mode $c +o $a"
return 1
}
####HELP STUFF
proc dcchelp {i t} {
putdcc $i "no online help for bacon commands... sorry
}
####HELP END
# *!* END *!* #
if {${chan-modes} || ${chan-modes} == "on"} {
binds_chan_modes "on"
}
if {${chan-fun} || ${chan-fun} == "on"} {
binds_fun "on"
}
if {${bot-chans} || ${bot-chans} == "on"} {
binds_channels "on"
}
if {${bot-users} || ${bot-users} == "on"} {
binds_users "on"
}
if {${chan-master} || ${chan-master} == "on"} {
binds_master "on"
}
binds_always "on"
fixgainops